﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

using StructureMap;
using StructureMap.Graph;
using MSDIS.Configuration;

namespace MSDIS.Web.Injection
{
    public static class IoC
    {
        public static void Initialize()
        {
            IContainer container = new Container(x =>
            {
                x.Scan(scan =>
                {
                    scan.TheCallingAssembly();
                    scan.WithDefaultConventions();
                });

                x.For<IConfigurationService>()
                    .Use<ConfigurationService>();
            });

            ConfigurationManager = container.GetInstance<IConfigurationService>();
            container.Inject<IConfigurationService>(ConfigurationManager);
        }

        public static IConfigurationService ConfigurationManager { get; set; }

    }
}